package com.buybuyyi.stylistcrm;

/**
 * Created by yanwc on 2016/9/17.
 */

import java.io.Serializable;

/**
 * 业务实体对象
 * @param <Tid>
 */
public class Entity<Tid>  implements Serializable {
    private Tid id;

    public Tid getId() {
        return id;
    }

    public void setId(Tid id) {
        this.id = id;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj == null){
            return false;
        }
        if(!(obj  instanceof Entity)){
            return false;
        }
        Entity t = (Entity)obj;
        if(t.getId() == this.getId()){
            return true;
        }
        if(t.getId() == null){
            return false;
        }
        if(t.getId().equals(this.getId())){
            return true;
        }else{
            return false;
        }
    }

    @Override
    public int hashCode() {
        return this.id.hashCode();
    }

    @Override
    public String toString() {
        //动态获取类的属性，标准格式输出
        return super.toString();
    }
}
